FROM ubuntu:20.04


# 设置环境变量，避免交互式配置
ENV DEBIAN_FRONTEND=noninteractive
# 设置时区为UTC（或者你需要的时区）
ENV TZ=UTC

# 更新包列表并安装基本工具
RUN apt-get update && \
    apt-get install -y \
    build-essential \
    cmake \
    vim \
    git

# 安装OpenCV的依赖项
RUN apt-get install -y \
    libopencv-dev

# 克隆OpenCV的GitHub存储库
COPY opencv /opt/opencv
COPY 06-antishape_V1_5 /antishape/06-antishape_V1_5

# 设置工作目录
WORKDIR /opt/opencv

# 创建并进入构建目录
RUN mkdir build && cd build

# 设置工作目录
WORKDIR /opt/opencv/build

# 使用CMake构建OpenCV
RUN cmake ..

# 编译并安装OpenCV
RUN make && make install

# 设置工作目录
WORKDIR /antishape/06-antishape_V1_5/3rd_part/eigen-3.4.0/build
RUN rm -rf * && cmake .. && make && make install
cp -r /usr/local/include/eigen3/Eigen /usr/include
cp -r /usr/local/include/eigen3/signature_of_eigen3_matrix_library /usr/include
cp -r /usr/local/include/eigen3/unsupported /usr/include

WORKDIR /antishape/06-antishape_V1_5/3rd_part/jsoncpp-1.9.5/build
RUN rm -rf * && cmake .. && make && make install


WORKDIR /antishape/06-antishape_V1_5/build
RUN rm -rf * && cmake .. && make 
CMD ["./test"]


# 清理安装过程中生成的文件
#RUN rm -rf /opt/opencv

# 设置工作目录
#WORKDIR /app

# 复制你的C++应用程序到容器中
#COPY . /app

# 编译你的C++应用程序
#RUN g++ -o your_cpp_app your_cpp_app.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc

# 指定容器启动时运行的命令
#CMD ["./your_cpp_app"]


